feat(prefix): auto-tune prefix match cap from model max_model_len#1721
feat(prefix): auto-tune prefix match cap from model max_model_len#1721mayur-tolexo wants to merge 1 commit into
Conversation
|
🚨 Unsigned commits detected! Please sign your commits. For instructions on how to set up GPG/SSH signing and verify your commits, please see GitHub Documentation. |
610b377 to
d602688
Compare
|
Thank you for the contribution! I think the goal is very aligned with where we wanna take the project.
The That makes the models source a dependency of the cap derivation, so it should be declared as one. |
d602688 to
b455c6a
Compare
Thanks for the guidance - reworked it. max_model_len now rides the existing models attribute: added |
6269f42 to
d002e73
Compare
|
Ok after further thinking - I think we can just go right away for the proper solution of creating an So it would be an The consumer stays as-is, only the source flips from the per-tick poll to a once-on-add fetch. What do you think? |
+1, let's go with the extractor approach. Reading through #38147, will update the PR. |
|
To clarify, the attached vLLM issue would be where we're heading, for the scope of this PR we'd still be only looking at |
d002e73 to
cc813e5
Compare
cc813e5 to
5d4c810
Compare
The approximate-prefix-cache producer caps prefix matching at a fixed maxPrefixTokensToMatch (default 128k). On models with a larger context window that under-matches long shared prefixes, and it's one more knob to set per model. When autoTune is on and maxPrefixTokensToMatch is left at its default, derive the cap from each endpoint's max_model_len instead, falling back to the existing default when it isn't known. An explicitly configured cap is always respected. max_model_len rides the existing /v1/models attribute. Rather than poll that endpoint on a timer for information that's fixed for an endpoint's lifetime, a new models-endpoint-extractor fetches /v1/models once when an endpoint is added and stores the model list (now carrying max_model_len) as an attribute. It registers as the default producer of that attribute and self-wires an endpoint-notification source, so the producer only declares the dependency and reads the value. A failed or slow fetch leaves the attribute unset and the cap falls back to the default. Signed-off-by: Mayur Das <mayur.das@neevcloud.com>
5d4c810 to
735f527
Compare
|
This PR is marked as stale after 21d of inactivity. After an additional 14d of inactivity (7d to become rotten, then 7d more), it will be closed. To prevent this PR from being closed, add a comment or remove the |
|
@mayur-tolexo @vMaroon - please close if not actively pursuing |
Closes #1505.
The prefix-cache producer caps matching at a fixed
maxPrefixTokensToMatch(default 128k), which under-matches long prefixes on larger-context models and is one more thing to tune per model. Per the discussion on #1505, this auto-tunes it from the model'smax_model_lenwhenautoTuneis on and the cap is left at its default. An explicitly set cap is still respected.max_model_lenisn't a metric, so it's read from/v1/models— fetched once per pod off the request path and cached, with concurrent misses collapsed to one fetch. Until it resolves, or if the pod can't be reached, we fall back to the current default, so nothing changes in the common case. The fetch reuses themodel-server-metricsscheme/TLS flags, and cached entries are dropped when a pod leaves the active set.Note: like the metrics scraper, the
/v1/modelsrequest isn't authenticated — a follow-up if secured model servers are in scope.